Function Remove-ADgroup
	{
		#Variable that contains the contents of the group list
		$d = Get-Content "D:\Powershell\RemovalGroups.txt"
		#Name of local group to remove user or group from  
		$localGroupName = 'Administrators'
		#Variable that contains the contents of the servername list  
		$c = Get-Content "D:\Powershell\Computers.txt"
		If (($d -ne $Null) -and ($c -ne $null)) {
		#read each name and execute below script against each name in the list  
			foreach ($comp in $c)
			{
			#Variable reassignment  
				$computerName = $comp
			#read each name and execute below script against each name in the list  
				foreach ($user in $d)
				{
				#Variable reassignment  
					$userName = $user
				#This reads the local domain and prepends it to the USERID  
					[string]$domainName = ([ADSI]'').name
				# We are providing a yes so that we are not prompted for each computer  
					$confirm = "Y"
					if ($confirm -eq "Y") {
	
			#We could output this to a file for future reference 
						try
						{
							write-host "Removing $userName from $localGroupName group on computer $computerName"
							([ADSI]"WinNT://$computerName/$localGroupName,group").remove("WinNT://$domainName/$userName")
							Write-Host "$domainName\$userName has been removed from local group $localGroupName on computer $computerName." -foregroundcolor Green
						}
						Catch [System.Management.Automation.MethodInvocationException]
						{
							write-host "Caught an exception:" -ForegroundColor Red
							if ($($_.Exception.Message) -Like "*not a member*") {
								write-host "'$domainName\$userName' is not a member of $localGroupName group on computer $computerName" -ForegroundColor Magenta
							} elseif($($_.Exception.Message) -Like "*does not exist*") {
								write-host "'$domainName\$userName' could not be removed from $localGroupName group because this group does not exist." -ForegroundColor Red
							} else {
								write-host "Access Denied for current user to execute against computer $computerName" -ForegroundColor cyan
							}
						}  
					} 
				}
			}
		} else {
		write-host "Pre-requisite is not in place" -ForegroundColor Red
		}		
	}